<!DOCTYPE html>
<html
  layout:decorator="components/layout"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  lang="zh-CN"
>
<head>
  <title>账户管理</title>
</head>
<body>
<div
  layout:fragment="content"
  id="app" v-cloak
>
  <div class="container">

    <div class="myHeader">
      <div class="myHeader-title">
        权限摘要
      </div>
    </div>
    <table
      width="100%"
      align="center"
      cellpadding="0"
      cellspacing="0"
      class="el-table el-table--border"
      border="0"
    >
      <tbody>
      <tr>
        <td
          width="100"
          class="TitleTD"
        >
          <a
            href="#"
            onclick="forward('/system-config/admin_privilege_admin_list.html')"
          >管理员总数</a>
        </td>
        <td
          class="ContentTD"
          align="left"
        >{{sysUserCount}}
        </td>
      </tr>
      <tr>
        <td class="TitleTD">管理员组总数</td>
        <td
          class="ContentTD"
          align="left"
        >{{sysRoleList.length}}
        </td>
      </tr>
      </tbody>
    </table>

    <div class="myHeader">
      <div class="myHeader-title">
        最近添加的5位管理员
      </div>
      <div class="myHeader-tool">
        <el-button
          size="mini"
          type="primary"
          @click="_forward('/system-config/admin_privilege_admin_list')"
          id="search"
        >管理员列表
        </el-button>
        <el-button
          @click="_forward('/system-config/add/admin_privilege_admin_add')"
          size="mini"
          type="primary"
          v-realm="'system-configuration:sys-user:edit'"
        >新增管理员
        </el-button>
      </div>
    </div>
    <table
      width="100%"
      cellpadding="0"
      cellspacing="0"
      class="el-table el-table--border"
      border="0"
    >
      <tbody>
      <tr>
        <td
          class="TitleTD"
          width="30"
          nowrap=""
        >编号
        </td>
        <td class="TitleTD">用户名</td>
        <td class="TitleTD">邮箱</td>
        <td class="TitleTD">管理员组</td>
        <td
          class="TitleTD"
          nowrap=""
        >创建时间
        </td>
        <td
          class="TitleTD"
          nowrap=""
        >上次登录
        </td>
        <td
          class="TitleTD"
          nowrap=""
        >登录来源
        </td>
        <td class="TitleTD">状态</td>
        <td class="TitleTD">操作</td>
      </tr>
      <!-- superuser_item/ -->
      <tr
        v-for="sysUser in sysUserList"
        onmouseover="this.style.backgroundColor ='#ffffd2'"
        onmouseout="this.style.backgroundColor ='#FFFFFF'"
        style="background-color: rgb(255, 255, 255);"
      >
        <td class="ContentTD">{{sysUser.id}}</td>
        <td class="ContentTD">
          <a
            @click="editUser(sysUser)"
            href="#"
          >{{sysUser.loginName}}</a>
        </td>
        <td class="ContentTD">
          <a
            @click="editUser(sysUser)"
            href="#"
          >{{sysUser.regMail}}</a>
        </td>
        <td class="ContentTD">
          <div v-for="sysUserRole in sysUser.sysUserRoleList">
            {{fieldFormatter.generator(sysRoleMap)(sysUserRole.roleId)}}
          </div>
        </td>
        <td class="ContentTD">{{dateFormat(sysUser.createTime)}}</td>
        <td class="ContentTD">{{dateFormat(sysUser.lastLoginTime)}}</td>
        <td class="ContentTD">{{sysUser.loginSource}}</td>
        <td class="ContentTD">
          <font color="green">{{fieldFormatter.generator(fieldFormatter.sysUser.statusMap)(sysUser.status)}}</font>
        </td>
        <td class="ContentTD">
          <span>
            <el-button
              type="primary"
              size="mini"
              v-realm="'system-configuration:sys-user:edit'"
              @click="editUser(sysUser)"
            >编辑
          </el-button>
          </span>
          <span>
            <el-button
              type="primary"
              size="mini"
              @click="deleteUser(sysUser.id)"
              v-realm="'system-configuration:sys-user:edit'"
            >删除
          </el-button>
          </span>
        </td>
      </tr>
      <!-- /superuser_item -->
      </tbody>
    </table>


    <div class="myHeader">
      <div class="myHeader-title">
        管理员组列表
      </div>
      <div class="myHeader-tool">
        <el-button
          size="mini"
          type="primary"
          @click="addRole"
          v-realm="'system-configuration:sys-user:edit'"
        >新增组
        </el-button>
      </div>
    </div>
    <table
      width="100%"
      cellpadding="0"
      cellspacing="0"
      class="el-table el-table--border"
      border="0"
    >
      <tbody>
      <tr>
        <td
          class="TitleTD"
          width="30"
          nowrap=""
        >编号
        </td>
        <td
          class="TitleTD"
          nowrap=""
        >管理员组
        </td>
        <td class="TitleTD">包含管理员数量</td>
        <td class="TitleTD">创建时间</td>
        <td class="TitleTD">说明</td>
        <td class="TitleTD">状态</td>
        <td class="TitleTD">操作</td>
      </tr>
      <!-- group_item/ -->
      <tr
        v-for="sysRole in sysRoleList"
        onmouseover="this.style.backgroundColor ='#ffffd2'"
        onmouseout="this.style.backgroundColor ='#FFFFFF'"
        style="background-color: rgb(255, 255, 255);"
      >
        <td class="ContentTD">{{sysRole.id}}</td>
        <td class="ContentTD">
          <a
            @click="editRole(sysRole)"
            href="#"
          >{{sysRole.name}}</a>
        </td>
        <td class="ContentTD">{{sysRole.userCount}}</td>
        <td class="ContentTD">{{dateFormat(sysRole.createTime)}}</td>
        <td class="ContentTD">{{sysRole.description}}</td>
        <td class="ContentTD">
          <font color="green">{{fieldFormatter.generator(fieldFormatter.sysUser.statusMap)(sysRole.status)}}</font>
        </td>
        <td class="ContentTD">
          <el-button
            type="primary"
            size="mini"
            @click="editRole(sysRole)"
            v-realm="'system-configuration:sys-user:edit'"
          >编辑
          </el-button>
          <el-button
            type="primary"
            size="mini"
            @click="deleteRole(sysRole.id)"
            v-realm="'system-configuration:sys-user:edit'"
          >删除
          </el-button>
        </td>
      </tr>
      <!-- /group_item -->
      </tbody>
    </table>

    <div class="myHeader">
      <div class="myHeader-title">
        授权IP访问
      </div>
    </div>

    <table
      width="100%"
      cellpadding="0"
      cellspacing="0"
      class="el-table el-table--border"
      border="0"
    >
      <tbody>
      <tr>
        <td
          width="200"
          class="TitleTD"
        >设置授权IP访问必看
        </td>
        <td>
          1、授权访问IP是针对管理员访问信息安全管理系统时的来源IP进行授权，不在该授权范围的IP将无法进行登陆信息安全管理系统。<br>
          2、未设置任何授权IP访问列表时系统不启用该功能，当设置启用该功能后只有设置授权IP地址才能管理系统。
          <br> 3、建议最好设置一项可以浏览信息安全管理系统的静态IP地址。大部分客户使用上网方式为动态IP，IP会经常发生变成，建议针对IP段进行授权。
        </td>
      </tr>
      <tr>
        <td
          width="200"
          class="TitleTD"
        >您当前上网IP为
        </td>
        <td>{{currentIp}}</td>
      </tr>
      <tr>
        <td
          width="200"
          class="TitleTD"
        >是否启用授权IP访问
        </td>
        <td>
          <rx-radio
            v-model="allowIpEnable.configValue"
            :map="allowIpEnableMap"
            @change="updateAllowIpEnable"
          ></rx-radio>
        </td>
      </tr>
      <tr>
        <td class="TitleTD">授权IP地址
          <el-button
            type="primary"
            size="mini"
            @click="addIp(2)"
            v-realm="'system-configuration:sys-user:edit'"
          >添加IP段
          </el-button>
          <el-button
            type="primary"
            size="mini"
            @click="addIp(1)"
            v-realm="'system-configuration:sys-user:edit'"
          >添加单IP
          </el-button>
        </td>
        <td>
          <table
            id="frm_ip"
            name="frm_ip"
            border="0"
          >
            <tbody>
            <tr v-for="(sysAuthIpSeg, i) in sysAuthIpSegList">
              <td>
                <input
                  v-model="sysAuthIpSeg.startIp"
                  class="input_text"
                  size="15"
                >
                {{sysAuthIpSeg.authType === 2 ? '-' : ''}}
              </td>
              <td v-if="sysAuthIpSeg.authType === 2">
                <input
                  v-model="sysAuthIpSeg.endIp"
                  class="input_text"
                  size="15"
                >
              </td>
              <td
                align="left"
                width="300"
              >
                <div
                  v-if="sysAuthIpSeg.authType === 1"
                  class="msg"
                >只有单个IP时只需填写起始IP
                </div>
                <button
                  v-if="sysAuthIpSegList.length > 1"
                  @click="deleteSysAuthIpSeg(i)"
                  class="btn_common"
                >删除
                </button>
              </td>
            </tr>
            </tbody>
          </table>
        </td>
      </tr>
      </tbody>
    </table>

    <div
      align="center"
      v-realm="'system-configuration:sys-user:edit'"
    >
      <el-button
        @click="updateSysAuthIpSeg"
        type="primary"
        size="mini"
      >确认
      </el-button>&nbsp;
      <el-button
        type="primary"
        size="mini"
        @click="init"
      >重置
      </el-button>
    </div>
  </div>
</div>
<div layout:fragment="js">
  <script src="/static/js/module/system-config/model/SysUser.js"></script>
  <script src="/static/js/module/system-config/model/SysUserRole.js"></script>
  <script src="/static/js/module/system-config/model/SysAuthIpSeg.js"></script>
  <script src="/static/js/module/system-config/model/SystemConfig.js"></script>
  <script src="/static/js/module/system-config/api/sysUserApi.js"></script>
  <script src="/static/js/module/system-config/api/sysRoleApi.js"></script>
  <script src="/static/js/module/system-config/api/sysAuthIpSegApi.js"></script>
  <script src="/static/js/module/system-config/api/sysConfigurationApi.js"></script>
  <script src="/static/js/module/system-config/admin_privilege.js"></script>
</div>
</body>
</html>
